home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Embed / Sources / Proxy.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  4.1 KB  |  161 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Proxy.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                M.Boetcher
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "Embed.hpp"
  13.  
  14. // ----- Embed Part Includes -----
  15.  
  16. #ifndef PROXY_H
  17. #include "Proxy.h"
  18. #endif
  19.  
  20. #ifndef PART_H
  21. #include "Part.h"
  22. #endif
  23.  
  24. #ifndef FRAME_H
  25. #include "Frame.h"
  26. #endif
  27.  
  28. #ifndef DEFINES_K
  29. #include "Defines.k"
  30. #endif
  31.  
  32. // ----- ODF Includes -----
  33.  
  34. #ifndef FWFRMING_H
  35. #include "FWFrming.h"
  36. #endif
  37.  
  38. #ifndef FWUTIL_H
  39. #include "FWUtil.h"
  40. #endif
  41.  
  42. #ifndef FWPRESEN_H
  43. #include "FWPresen.h"
  44. #endif
  45.  
  46. #ifndef FWFCTCLP_H
  47. #include "FWFctClp.h"
  48. #endif
  49.  
  50. #ifndef FWODGEOM_H
  51. #include "FWODGeom.h"
  52. #endif
  53.  
  54. #ifndef FWITERS_H
  55. #include "FWIters.h"
  56. #endif
  57.  
  58. // ----- OpenDoc Includes -----
  59.  
  60. #ifndef SOM_ODShape_xh
  61. #include <Shape.xh>
  62. #endif
  63.  
  64. #ifndef SOM_ODTransform_xh
  65. #include <Trnsform.xh>
  66. #endif
  67.  
  68. #ifndef SOM_ODSession_xh
  69. #include <ODSessn.xh>
  70. #endif
  71.  
  72. //========================================================================================
  73. // RunTime Info
  74. //========================================================================================
  75.  
  76. #ifdef FW_BUILD_MAC
  77. #pragma segment odfembed
  78. #endif
  79.  
  80. //========================================================================================
  81. //    class CEmbedProxy
  82. //========================================================================================
  83.  
  84. //----------------------------------------------------------------------------------------
  85. //    CEmbedProxy constructors
  86. //----------------------------------------------------------------------------------------
  87.  
  88. CEmbedProxy::CEmbedProxy(Environment* ev, CEmbedPart* part, FW_CPresentation* presentation) :
  89.     FW_MProxy(ev, part, presentation),
  90.     fPart(part)
  91. {
  92. }
  93.  
  94. //----------------------------------------------------------------------------------------
  95. //    CEmbedProxy::~CEmbedProxy
  96. //----------------------------------------------------------------------------------------
  97.  
  98. CEmbedProxy::~CEmbedProxy()
  99. {
  100. }
  101.  
  102. //----------------------------------------------------------------------------------------
  103. //    CEmbedProxy::UsedShapeChanged
  104. //----------------------------------------------------------------------------------------
  105. //    Used shape of an embedded frame changed. Just invalidate and recalculate its clip
  106.  
  107. void CEmbedProxy::UsedShapeChanged(Environment* ev,
  108.                                    FW_CEmbeddingFrame* embeddingFrame,
  109.                                    ODFrame* odEmbeddedFrame)
  110. {
  111. FW_UNUSED(odEmbeddedFrame);
  112.  
  113.     // ----- Recalculate the clip -----
  114.     if (fPart->FacetNumber() == cOneFacet)
  115.     {
  116.         // ----- Use the standard facet clipper 
  117.         FW_CFacetClipper clipper(ev, fPart);
  118.         clipper.Clip(ev, embeddingFrame);
  119.     }
  120.     else
  121.     {
  122.         //     I cannot use the standard facet clipper because it only works for one facet
  123.         //    Because I know in which order the facets were created I can just iterates 
  124.         FW_CRect clipRects[4];
  125.         ((CEmbedFrame*)embeddingFrame)->EmbeddedFacetBounds(ev, clipRects);
  126.             
  127.         FW_CFrameFacetIterator ite(ev, embeddingFrame);
  128.         for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  129.         {
  130.             short n = 0;
  131.             FW_CFacetIterator ite2(ev, facet);
  132.             for (ODFacet* embeddedFacet = ite2.First(ev); ite2.IsNotComplete(ev); embeddedFacet = ite2.Next(ev))
  133.             {
  134.                 FW_CAcquiredODShape aqClipShape = FW_NewODShape(ev, clipRects[n]);
  135.                 embeddedFacet->ChangeGeometry(ev, aqClipShape, NULL, NULL);
  136.                 n++;
  137.             }
  138.         }
  139.     }
  140.  
  141.     embeddingFrame->Invalidate(ev);
  142. }
  143.  
  144. //----------------------------------------------------------------------------------------
  145. //    CEmbedProxy::FrameShapeRequested
  146. //----------------------------------------------------------------------------------------
  147. //    We always want the embedded frame to have our frame shape
  148.  
  149. ODShape* CEmbedProxy::FrameShapeRequested(Environment* ev, 
  150.                                         FW_CEmbeddingFrame* embeddingFrame, 
  151.                                         ODFrame* odEmbeddedFrame, 
  152.                                         ODShape* requestedFrameShape)
  153. {
  154. FW_UNUSED(requestedFrameShape);
  155. FW_UNUSED(odEmbeddedFrame);
  156.  
  157.     return ((CEmbedFrame*)embeddingFrame)->MakeFrameShape(ev);     // No FW_CAcquiredODShape because we are returning it
  158. }
  159.  
  160.  
  161.